# -*- coding: utf-8 -*-
from django.contrib import admin
from app_TuringClass.models import *
# Register your models here.

## author：houchaoqun
## function：Django-admin test from http://wiki.jikexueyuan.com/project/django-chinese-docs-18/7_2_Admin-actions.html
## date：2016/11/08
'''
class ArticleAdmin(admin.ModelAdmin):
	## 设置[django-admin]标签
	## list_display 在界面上显示的内容
	## ordering 根据哪个属性进行排序
	## actions 显示在界面上的“Aciton”处，点击可触发相应的函数
    list_display = ['title', 'body','status']
    ordering = ['title']
    actions = ['make_published', 'make_draft']

    # 已选中对象集合为参数的回调函数
    def make_published(self, request, queryset):
    	rows_updated = queryset.update(status = 'p')
        if rows_updated == 1:
            message_bit = "1 story was"
        else:
            message_bit = "%s stories were" % rows_updated
        self.message_user(request, "%s successfully marked as published." % message_bit)


    def make_draft(self, request, queryset):
    	rows_updated = queryset.update(status = 'd')
    	if rows_updated == 1:
    		message_bit = "1 story was"
    	else:
    		message_bit = "%s stories were" % rows_updated
    	self.message_user(request, "%s successfully marked as drafted." % message_bit)

admin.site.register(Article, ArticleAdmin)
'''
## author：houchaoqun
## function：QuestionTag table
## date：2016/11/22
class QuestionTagAdmin(admin.ModelAdmin):
    pass
admin.site.register(QuestionTag, QuestionTagAdmin)

## author：houchaoqun
## function：QuestionTag table
## date：2016/11/22
class QuestionListAdmin(admin.ModelAdmin):
    pass
admin.site.register(QuestionList, QuestionListAdmin)

## author：houchaoqun
## function：QuestionDetails table
## date：2016/11/22
class QuestionDetailsAdmin(admin.ModelAdmin):
    pass
admin.site.register(QuestionDetails, QuestionDetailsAdmin)

## author：houchaoqun
## function：QuestionAnswers table
## date：2016/11/22
class QuestionAnswersAdmin(admin.ModelAdmin):
    pass
admin.site.register(QuestionAnswers, QuestionAnswersAdmin)

class UploadingFilesAdmin(admin.ModelAdmin):
    pass
admin.site.register(UploadingFiles, UploadingFilesAdmin)

